/*
 * @FilePath: account.ts
 * @@author: wjj
 * @Date: 2025-08-06 10:14:37
 * @@Description: new js file
 */
import request from '@/utils/request'
enum API {
  UPDATEUSER_URL = '/nimi/activity/account/update_account',
  UPDATEUSERS_URL = '/nimi/activity/account/update_accounts',
  ALLUSER_URL = '/nimi/activity/account/get_account',
  ADDUSER_URL = '/nimi/activity/account/create_account',
  ALL_UPDATE = '/nimi/activity/account/all_update_accounts',
}
//获取用户账号信息的接口
export const reqAccountInfo = (
  page: number,
  limit: number,
  keyword: string,
  asc: string,
) =>
  request.get<any, any>(
    API.ALLUSER_URL +
      `?page=${page}&page_size=${limit}&keyword=${keyword}&asc=${asc}`,
  )
//添加用户与更新已有用户的接口
export const reqAddUser = (data: any) => {
  //携带参数有ID更新
  return request.post<any, any>(API.ADDUSER_URL, data)
}
//批量更新的接口
export const updateUserList = (type: number, idList: number[]) =>
  request.post(API.UPDATEUSERS_URL, { type, idList })

//全量更新的接口
export const updateAll = (type: number) => request.post(API.ALL_UPDATE, {})

//更新的接口
export const updateUser = (type: number, id: number, device_id: string) =>
  request.put(API.UPDATEUSER_URL, { type, id, device_id })
